package com.exam.service.impl;

import com.exam.mapper.PaperManageMapper;
import com.exam.pojo.ExamMessage;
import com.exam.pojo.PaperManage;
import com.exam.service.PaperManageService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PaperManageServiceImpl implements PaperManageService {

    @Resource
    private PaperManageMapper paperManageMapper;
    @Override
    public PaperManage queryById(Integer id) {
        return paperManageMapper.queryById(id);
    }

    @Override
    public List<PaperManage> queryAll() {
        return paperManageMapper.queryAll();
    }

    @Override
    public PageInfo<PaperManage> queryAllPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<PaperManage> paperManages = paperManageMapper.queryAll();
        PageInfo<PaperManage> pageInfo = new PageInfo<>(paperManages);
        return pageInfo;
    }

    @Override
    public int updateById(PaperManage paperManage) {
        return paperManageMapper.updateById(paperManage);
    }

    @Override
    public int deleteById(Integer id) {
        return paperManageMapper.deleteById(id);
    }

    @Override
    public int add(PaperManage paperManage) {
        return paperManageMapper.insert(paperManage);
    }

    @Override
    public List<PaperManage> queryByPaperCreatorId(Integer paperCreatorId) {
        return paperManageMapper.queryByPaperCreatorId(paperCreatorId);
    }
}
